package com.qx.dao;

import com.qx.pojo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class DepartmentDao {
    @Autowired
    public static Map<Integer, Department> departments = null;

    static {
        departments = new HashMap<>();
        departments.put(1, new Department(1, "技术部"));
        departments.put(2, new Department(2, "财务部"));
        departments.put(3, new Department(3, "市场部"));
        departments.put(4, new Department(4, "调研部"));
        departments.put(5, new Department(5, "后勤部"));
    }

    public Collection getDepartments() {
        return departments.values();
    }

    public Department getDepartment(Integer id) {
        return departments.get(id);
    }

}
